<?php
/**
 * @fileName:FileLogger.php
 * @project:alice
 * @author : 吐火青蛙
 * @user : 吐火青蛙
 * @date : 2020/4/10
 *
 */

namespace miaosang\basicknowledge\design\factorymethod;

use miaosang\basicknowledge\design\factorymethod\Logger;
class FileLogger implements Logger
{
    /**
     * @var string
     */
    private $filePath;

    public function __construct(string $filePath)
    {
        $this->filePath = $filePath;
    }

    /**
     * @param string $message
     * @return mixed
     */
    public function log(string $message)
    {
        file_put_contents($this->filePath,$message.PHP_EOL,FILE_APPEND);
    }
}
